1 package controllers
.actions
;
3 import javax
.swing
.undo
.AbstractUndoableEdit
;
4 import models
.GraphVertex
;
7 public class Rename
extends AbstractUndoableEdit
{
8 private static final long serialVersionUID
= -7929100929760152271L;
10 private String savedName
;
11 private int originalWidth
;
12 private SelectionController selectionController
;
14 public Rename(String name
, SelectionController selectionController
)
16 this.selectionController
= selectionController
;
17 this.savedName
= name
;
18 this.o
= selectionController
.getSelectedVertex();
19 originalWidth
= o
.getWidth();
23 private void redoAction(){
24 int width
= 20 + this.selectionController
.getPanel().getDrawTextWidth(savedName
);
25 if(width
> o
.getWidth())
28 String objectName
= o
.getName();
30 savedName
= objectName
;
41 String objectName
= o
.getName();
43 o
.setWidth(originalWidth
);
44 savedName
= objectName
;
46 public boolean isSignificant(){
50 public String
getPresentationName(){
51 return "Vertex Hernoemen.";